/* GUI CONVERTED from reophist.p (converter v1.75) Sat Aug 12 23:06:38 2000 */
/* reophist.p - REPETITIVE                                                    */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/*F0PN*/ /*V8:ConvertMode=Maintenance                                         */
/*J2DG*/ /*V8:RunMode=Character,Windows                                       */
/* REVISION: 7.3               LAST MODIFIED: 10/31/94   BY: WUG *GN77*       */
/* REVISION: 9.0               LAST MODIFIED: 04/16/99   BY: *J2DG* Reetu Kapoor */
/* REVISION: 9.1               LAST MODIFIED: 08/12/00   BY: *N0KP* myb          */


/*J2DG*/ /* ADDED NO-UNDO AND REPLACED FIND STATEMENTS WITH FOR FIRST     */
/*J2DG*/ /* STATEMENTS FOR ORACLE PERFORMANCE.                            */


/* SUBPROGRAM TO CREATE op_hist RECORD                                        */

{mfdeclre.i}

define input parameter trans_type    as character no-undo.
define input parameter wolot         as character no-undo.
define input parameter op            as integer   no-undo.
define input parameter emp           as character no-undo.
define input parameter wkctr         as character no-undo.
define input parameter mch           as character no-undo.
define input parameter dept          as character no-undo.
define input parameter shift         as character no-undo.
define input parameter eff_date      as date      no-undo.
define output parameter ophist_recid as recid     no-undo.


/*J2DG** find wo_mstr where wo_lot = wolot no-lock.                         */
/*J2DG** find wr_route where wr_lot = wolot and wr_op = op no-lock no-error.*/

/*J2DG*/ for first wo_mstr
/*J2DG*/    fields (wo_line wo_lot wo_part wo_site)
/*J2DG*/    where wo_lot = wolot no-lock:
/*J2DG*/ end. /* FOR FIRST WO_MSTR */

/*J2DG*/ for first wr_route
/*J2DG*/    fields (wr_lot wr_milestone wr_op wr_run wr_setup)
/*J2DG*/    where wr_lot = wolot
/*J2DG*/      and wr_op = op no-lock:
/*J2DG*/ end. /* FOR FIRST WR_ROUTE */

create op_hist.
{mfnoptr.i}

assign
op_date = eff_date
op_dept = dept
op_emp = emp
op_line = wo_line
op_mch = mch
op_part = wo_part
op_program = execname
op_shift = shift
op_site = wo_site
op_time = time
op_tran_date = today
op_type = trans_type
op_userid = global_userid
op_wkctr = wkctr
op_wo_lot = wolot
op_wo_op = op
.

if available wr_route then do:
   assign
   op_milestone = wr_milestone
   op_std_run = wr_run
   op_std_setup = wr_setup.
end.

ophist_recid = recid(op_hist).
